/*
 * Copyright (C) 2000-2006 Sailing Group
 * 
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details.
 * 
 */
package lfp.monitor;

import com.jgoodies.looks.plastic.PlasticLookAndFeel;
import com.jgoodies.looks.plastic.PlasticXPLookAndFeel;
import com.jgoodies.looks.plastic.theme.DesertBlue;
import hhh.gui.frame.HAppEntry;
import hhh.gui.frame.HAppInfo;
import hhh.gui.frame.HMainFrame;
import hhh.utils.ResourceManager;
import org.apache.log4j.Logger;

import javax.swing.*;

public class Application extends HAppEntry {
    //private static Logger log = Logger.getLogger(Application.class);
    //
    //static {
    //    PlasticLookAndFeel.setPlasticTheme(new DesertBlue());
    //    //PlasticLookAndFeel.setPlasticTheme(new ExperienceGreen());
    //    try {
    //        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    //        //UIManager.setLookAndFeel(new PlasticXPLookAndFeel());
    //        //UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
    //    } catch (Exception e) {
    //        log.warn(e.getStackTrace());
    //    }
    //}

    //========================getInstance=========================
    private static HAppInfo info;

    public static HAppInfo getInstance() {
        if (info != null) return info;
        //
        ResourceManager rm = ResourceManager.get(Application.class);
        info = new HAppInfo(rm,  null);
        return info;
    }

    //======================Entry point=========================

    /**
     * application entry
     *
     * @param args input parameter
     */
    public static void main(String[] args) {
        HAppInfo info = getInstance();
        HMainFrame frame = init(info, args);
        frame.getCurrentActionMap().get("file.Open").actionPerformed(null);
    }

    /**
     * applet entry
     */
    public void init() {
        HAppInfo info = getInstance();
        init(info);
    }
}
